let ids = lib.eachId(args); 
if(ids && ids.length > 0){ 
        let type = lib.dbQueryJsonArray(`SELECT
			type 
		FROM
			adjustment_order ao
		WHERE
			ao.id = ? 
			AND ao.del_flag = 0`,ids[0]);
		if(type[0].type == "0"){
		let trans = lib.newTransaction();
			try{
				lib.serviceInvoke("adjustmentOrderServiceImpl","bad",ids[0]);
				lib.serviceInvoke("adjustmentOrderServiceImpl","good",ids[0]);
				trans.commit();
			}catch(e){
				lib.addUserMessage("单据异常："+e);
				trans.rollback();
			}
		
		}else if(type[0].type == "1"){
			let trans = lib.newTransaction();
			try{
				lib.serviceInvoke("adjustmentOrderServiceImpl","lockStockOut",ids[0]);
				lib.serviceInvoke("adjustmentOrderServiceImpl","stockIn",ids[0]);
				trans.commit();
			}catch(e){
				lib.addUserMessage("单据异常："+e);
				trans.rollback();
			}	
		} 
}
